package com.ticket.system.domain.enu;

import lombok.Getter;

/**
 * @ClassName : TicketStatusEnum
 * @Description :
 * @Author : lixiang
 * @Date: 2024/1/4  11:06
 */
@Getter
public enum TicketStatusEnum {
    ONE(0,"待出票"),
    TWO(1,"待出票"),
    THREE(2,"待核验"),
    FOUR(3,"已作废"),
    FIVE(4,"已核验"),
    SIX(5,"待核验"),
    SEVEN(6,"已退款"),
    EIGHT(7,"退款中"),
    NIGH(8,"已过期");

    private final int code;

    private final String value;

    TicketStatusEnum(int code, String value) {
        this.code = code;
        this.value = value;
    }

    public static TicketStatusEnum indexOf(Integer code) {
        for (TicketStatusEnum obj : TicketStatusEnum.values()) {
            if (code.equals(obj.getCode())) {
                return obj;
            }
        }
        return null;
    }

    public static TicketStatusEnum indexOfMsg(String msg) {
        for (TicketStatusEnum obj : TicketStatusEnum.values()) {
            if (msg.equals(obj.getValue())) {
                return obj;
            }
        }
        return null;
    }
}
